﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 namespace DAL
{
      public  class Login_RegisterServers
    {
       public static Customer SelectCustomer(string loginname,string loginpwd)
        {
            using(ShopContext db=new ShopContext())
            {
                
                Customer customer = db.Customer.SingleOrDefault(p => p.CustomerName == loginname && p.CustomerPassWord == loginpwd);
                return customer;
            }
        }
        public static int ZhuChe(Customer customer)
        {
            using (ShopContext db = new ShopContext())
            {
                Customer cus = new Customer
                {
                    CustomerName = customer.CustomerName,
                    CustomerPassWord = customer.CustomerPassWord,
                    CustomerEmail = customer.CustomerEmail,
                    CustomerPhone = customer.CustomerPhone,
                    CustomerSex = customer.CustomerSex == "男" ? "男" : "女",
                    CustomerLoginTime = DateTime.Now,
                    CustomerNiCheng="未定义",
                    CustomerTouXiang="~/img/tuz.png"
                    
                   
                };
                db.Customer.Add(cus);
               int res= db.SaveChanges();
                return res;
            }
              
        }
    }
}
